<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	UserBean user = (UserBean)request.getSession().getAttribute("userBean");
	
	String _db = user.getDbType();
	Map<String,List<Map<String, String>>> dicMap = user.getDicMap();
	List<Map<String, String>> list = null;
	String temp = "";
	
	String tbe_employment_forms = "";//用工形式
	String tbe_nation = "";//民族
	String tbe_marital_status = "";//婚姻状态
	String tbe_marital_condition = "";//婚姻状况
	String tbe_qualification = "";//学历
	String tbe_status = "";//员工状态
	String tbe_ba_status = "";//生育能力状态
	String tbe_birth_control_measures = "";//节育措施
	
	list = dicMap.get("101");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_employment_forms += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("5");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_nation += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("27");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_marital_status += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("7");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_marital_condition += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("8");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_qualification += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("102");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_status += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("103");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_ba_status += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("104");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_birth_control_measures += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />

		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerTree.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerDateEditor.js"></script>
		
		<script type="text/javascript" src="ligerUI/jquery-validation/jquery.validate.min.js" ></script> 
		<script type="text/javascript" src="ligerUI/jquery-validation/jquery.metadata.js"></script>
		<script type="text/javascript" src="ligerUI/jquery-validation/messages_cn.js" ></script>
		
<script type="text/javascript">
var _db = '<%=_db%>';

_jsonObj.classname = "com.wxtf.platform.main.employee.EmployeeAction";
_jsonObj.methodname = "queryPage";
_jsonObj.logicdata = "[{\"types\":\"init\"}]";


var win;//人员新建/修改弹出框
var win2;//高级检索弹出框
var win3;//机构弹出框
var win4;//机构弹出框
var manager;//人员表格
var arraySerarchList = new Array();//高级搜索条件数组

$(function(){
	validEvent("emp-form");
	
	manager = $("#emp-grid").ligerGrid({
		url: _url, parms: _jsonObj, width: '100%', height: '100%',
		usePager: true, rownumbers: true, checkbox: true, alternatingRow: true,
		columns: [
			{ display: 'tbe_id', name: 'tbe_id', hide: true,width:1 },
			{ display: 'org_id', name: 'org_id', hide: true,width:1 },
			{ display: '机构名称', name: 'reserve1', width:150, align:'left' },
			{ display: '身份证号', name: 'tbe_idcard', width: 150, align: 'left' },
			{ display: '职工证号', name: 'tbe_work_permit', width: 100, align: 'left' },
			{ display: '用工形式', name: 'tbe_employment_forms', width:  1, hide:true },
			{ display: '姓名', name: 'tbe_name', width: 100, align: 'left' },
			{ display: '曾用名', name: 'tbe_former_name',hide: true,width:1 },
			{ display: '拼音码', name: 'tbe_spell_code', width: 100, align: 'left' },
			{ display: '性别', name: 'tbe_sex', width: 60, align: 'left' },
			{ display: '出生日期', name: 'tbe_birthday', width: 100, align: 'left' },
			{ display: '年龄', name: 'tbe_age', hide: true,width:1 },
			{ display: '籍贯', name: 'tbe_native_palce', hide: true,width:1 },
			{ display: '民族', name: 'tbe_nation', width:  1, hide:true },
			{ display: '出生地', name: 'tbe_birthplace', width:  1, hide:true },
			{ display: '入厂时间', name: 'tbe_join_time', width:  1, hide:true },
			{ display: '工龄', name: 'tbe_seniority', width:  1, hide:true },
			{ display: '手机', name: 'tbe_mobile',hide: true,width:1  },
			{ display: '家庭电话', name: 'tbe_family_phone',hide: true,width:1 },
			{ display: '家庭住址', name: 'tbe_address', hide: true,width:1  },
			{ display: '婚姻状态', name: 'tbe_marital_status', width: 100, align: 'left',
				render: function(record, index, value, oth){
					<%
					list = dicMap.get("27");
					temp = "";
					if(null != list && list.size() > 0){
						for(Map<String, String> map: list){
					%>
					if(value == '<%=map.get("tmgd_id")%>'){
						<%
						temp = map.get("tmgd_name");
						%>
						return '<%=temp%>';
					}
					<%
						}
					}
					%>
					return value;
				}
			},
			{ display: '婚姻状况', name: 'tbe_marital_condition', width: 100, align: 'left',
				render: function(record, index, value, oth){
					<%
					list = dicMap.get("7");
					temp = "";
					if(null != list && list.size() > 0){
						for(Map<String, String> map: list){
					%>
					if(value == '<%=map.get("tmgd_id")%>'){
						<%
						temp = map.get("tmgd_name");
						%>
						return '<%=temp%>';
					}
					<%
						}
					}
					%>
					return value;
				}
			},
			{ display: '结婚时间', name: 'tbe_married_time', width:  1, hide:true },
			{ display: '结婚证号', name: 'tbe_marriage_certificate', width:  1, hide:true },
			{ display: '政治面貌', name: 'tbe_political_status', width:  1, hide:true },
			{ display: '学历', name: 'tbe_qualification', width:  1, hide:true },
			{ display: '毕业学校', name: 'tbe_graduate_college', width:  1, hide:true },
			{ display: '所学专业', name: 'tbe_major', width:  1, hide:true },
			{ display: '工作时间', name: 'tbe_work_area', width:  1, hide:true },
			{ display: '职务', name: 'tbe_position', width:  1, hide:true },
			{ display: '是否允许再生育', name: 'tbe_is_again_birth', width:  1, hide:true },
			{ display: '是否不孕症', name: 'tbe_is_barrenness', width:  1, hide:true },
			{ display: '是否绝经', name: 'the_is_menopause', width:  1, hide:true },
			{ display: '是否晚婚', name: 'tbe_is_late_marriage', width:  1, hide:true },
			{ display: '是否晚育', name: 'tbe_is_late_birth', width:  1, hide:true },
			{ display: '员工状态', name: 'tbe_status', width:  1, hide:true },
			{ display: '生育能力状态', name: 'tbe_ba_status', width:  1, hide:true },
			{ display: '节育措施', name: 'tbe_birth_control_measures', width:  1, hide:true },
			{ display: '设为重点时间', name: 'tbe_es_time', width:  1, hide:true },
			{ display: '是否重点服务对象', name: 'tbe_is_es', width:  1, hide:true },
			{ display: '重点理由', name: 'tbe_es_reason', width:  1, hide:true },
			{ display: '子女情况', name: 'tbe_children_status', width:  1, hide:true },
			{ display: '排序号', name: 'tbe_order', width:  1, hide:true },
			{
                    display: '晚婚+晚育', name: 'reserve2',width: 100, isSort:false,
                    render: function (row)
                    {
                       var html = '';
                       if(row.tbe_is_late_marriage=='1' && row.tbe_is_late_birth=='1'){
                       		html = '是';
                       }
                       else {
                       		html = '否';
                       }
                       return html;
                    }
            },
			{ display: '备注', name: 'tbe_memo', width:  1, hide:true },
			/*{ display: 'reserve2', name: 'reserve2', width:  1, hide:true },*/
			{ display: 'reserve3', name: 'reserve3', width:  1, hide:true },
			{ display: 'reserve4', name: 'reserve4', width:  1, hide:true },
			{ display: 'reserve5', name: 'reserve5', width:  1, hide:true },
			{ display: '录入人', name: 'create_by', width:  1, hide:true },
			{ display: '录入时间', name: 'create_time', width:  1, hide:true },
			{ display: '最后修改人', name: 'last_modify_by', width:  1, hide:true },
			{ display: '最后修改时间', name: 'last_modify_time', width: 1, hide:true },
			{ display: '编辑', name:'edit',width:60,render: function(row, index, value, oth){
					return "<img src='ligerUI/skins/icons/edit.gif' onclick='lateData(" + row + ")'></img>";
				}
			}
		],
		
	});

	
	/*
	 * 日期框
	 */
	$("#tbe_birthday").ligerDateEditor({ format: "yyyy-MM-dd", width:182 });
	$("#tbe_work_area").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	$("#tbe_join_time").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	$("#tbe_married_time").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	$("#tbe_es_time").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	
});

/*
 * 表格刷新
 */
function reload(){
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = "[{\"types\":\"init\"}]";
	manager.loadData();
}

/*
 * ajax成功回调
 */
function ajaxCallbackSuccFunc(data, textStatus){
	if(win){
		win.hide();
	}
	succMsgTip(data.resultrecord);
	reload();
}

/*
 * ajax失败回调
 */
function ajaxCallbackErrorFunc(data, textStatus){
	succMsgTip(data.resultrecord);
}

/*
 * 获取列表选中的人员ID
 */
function getUserIds(){
	var arrayUsers = manager.getSelecteds();
	if(arrayUsers.length == 0){
		return "";
	} else {
		var text = "";
		for(var i=0; i<arrayUsers.length; i++){
			text += arrayUsers[i].tbe_id + ",";
		}
		return text.substring(0, text.length - 1);
	}
}

/*
 * 新增/修改人员
 */
function addData(row){
	document.getElementById('emp-form').reset();

	if(row){
		loadForm("emp-form", row);
	} else {
		$("#tbe_id").val('');
	}
	
	if(win == null){
		win = initWindowByDiv('empAdd-div', '编辑人员', 880, 450 ,save, closeWin);
	}else{
		win.show();
	}
}

/*
 * 修改晚婚+晚育
 */
function lateData(row){
var userIds = row.tbe_id;;
	if(row){
		loadForm("emp-form", row);
		_jsonObj.methodname = "late";
		_jsonObj.logicdata = "[{\"ids\":\"" + userIds + "\"}]";
		callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
	} else {
		//
	}
}

/*
 * 新建/修改人员信息
 */
function save(){
	clearAllTip();//清除气泡
	if($("#emp-form").valid()){
		var text = $("#org_id").find("option:selected").text();
		text = text.replaceAll('-','');
		$('#reserve1').val(text);
		_jsonObj.logicdata = getForm("emp-form");
		var tbe_id = $("#tbe_id").val();
		if(tbe_id == ''){
			_jsonObj.methodname = "save";
			callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
		} else {
			_jsonObj.methodname = "update";
			callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
		}
	}
}

/*
 * 删除人员
 */
function delData(){
	var userIds = getUserIds();
	if(userIds == ""){
		succMsgTip('请至少选择一个用户进行操作');
		return;
	}
	$.ligerDialog.confirm('确定要删除选中的数据吗？（删除不可恢复）', function (opt) { 			
		if(opt){
			_jsonObj.methodname = "delete";
			_jsonObj.logicdata = "[{\"ids\":\"" + userIds + "\"}]";
			callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
		}
	});
}


/*
 * 重置-条件查询
 */
function serReset(){
	$('#ser5').val('0');
	$('#ser3').val('');
	$('#ser1').val('');
	$('#ser2').val('');
	$('#ser4').val('');
}

/*
 * 条件查询
 */
function serch1(){
	var orgIds = $('#org2').val();
	var tbe_employment_forms = $('#ser5').val();
	var tbe_work_permit = $('#ser3').val();
	var tbe_name = $('#ser1').val();
	var tbe_spell_code = $('#ser2').val();
	var tbe_idcard = $('#ser4').val();
	
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = '[{\"orgIds\":\"' + orgIds + '\",\"tbe_employment_forms\":\"' + tbe_employment_forms
			+ '\",\"tbe_work_permit\":\"' + tbe_work_permit + '\",\"tbe_name\":\"' + tbe_name
			+ '\",\"tbe_spell_code\":\"' + tbe_spell_code + '\",\"tbe_idcard\":\"' + tbe_idcard
			+ '\",\"types\":\"serch1\"}]';
	manager.loadData();
}

/*
 * 高级查询
 */
function serch2(){
	if(win2 == null){
		win2 = initWindowByDiv('tallSearch','高级查询', 670, 454, function(){
			var tableName = "";
        	var objArrayOne = $("[name=luojiOne]");
        	var objArrayTwo = $("[name=luojiTwo]");
        	var arrayColsName = $("[name=colsName]");
        	var arrayColsValue = $("[name=colsValue]");
        	
        	var tempSearch = "";
        	for(var i=0; i<arrayColsName.length; i++){
        		var conditionValue = objArrayOne[i+1].value;
        		if(conditionValue == "like"){
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" '%"+arrayColsValue[i].value+"%' ");
        		}else if(conditionValue == "in"){
        			var strArr = arrayColsValue[i].value.split(",");
        			var tempStr = "";
        			for(var j=0; j<strArr.length; j++){
        				tempStr +="'"+strArr[j]+"',";
        			}
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" ("+tempStr.substring(0,tempStr.length-1)+") ");
        		}else if(conditionValue == "between"){
        			var strArr = arrayColsValue[i].value.split(",");
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" '"+strArr[0]+"' and '"+strArr[1]+"' ");
        		}else if(conditionValue == "is null"){
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" ");
        		}else{
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" '"+arrayColsValue[i].value+"' ");
        		}
        	}
        	
        	var whereAnd = "";
        	for(var i=0;i<arraySerarchList.length;i++){
        		whereAnd += arraySerarchList[i];
        	}
        	
        	_jsonObj.methodname = "queryPage";
			_jsonObj.logicdata = '[{\"where\":\"' + whereAnd + '\",\"types\":\"serch2\"}]';
			manager.loadData();
        	
        	arraySerarchList.length = 0;
        	win2.hide();
        	
		},closeWin);
	}else{
		win2.show();
	}
}

/*
 * 动态给table添加一个tr-高级查询
 */
function tallSearchCols(clValue){
	var clName = $("option[value='" + clValue + "']").eq(0).text()
	if(clValue=="tbe_birthday" || clValue=="tbe_join_time" || clValue=="tbe_married_time"|| clValue=="tbe_work_area" || clValue=="tbe_es_time" ){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><input name="colsValue" class="times" type="text"></td><td width="90px">'+$("#conditionAnd").html()+'</td><td width="60px" style="cursor: pointer;" onClick="getDel(this)">删除</td></tr>');
		$(".times").ligerDateEditor({width :120});
	}else if(clValue=="tbe_is_es" || clValue=="tbe_is_barrenness" || clValue=="the_is_menopause" || clValue=="tbe_is_again_birth" || clValue=="tbe_is_late_birth" || clValue=="tbe_is_late_marriage"){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><option value="1">是</option><option value="0">否</option></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	}else if(clValue=="tbe_sex"){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><option value="男">男</option><option value="女">女</option></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	}else if(clValue == 'tbe_employment_forms'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_employment_forms%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_nation'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_nation%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_marital_status'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_marital_status%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_marital_condition'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_marital_condition%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_qualification'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_qualification%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_status'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_status%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_ba_status'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_ba_status%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_birth_control_measures'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><select name="colsValue" type="text" style="width:120px"><%=tbe_birth_control_measures%></select></td><td>'+$("#conditionAnd").html()+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else {
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="150px"><input name="colsValue" type="text" style="width:120px"></td><td width="90px">'+$("#conditionAnd").html()+'</td><td width="60px" style="cursor: pointer;" onClick="getDel(this)">删除</td></tr>');
	}
}

/*
 * 删除条件-高级查询
 */
function getDel(ele){
	$(ele).parent().remove();  
}

/*
 * 婚姻状况事件
 */
function changeEvent1(ele){
	var tbe_marital_status = $('#tbe_marital_status').val();
	if('8A90F0D0176C4961B322BEB26703A320' == tbe_marital_status){//未婚者没有婚姻状态
		ele.value = "";
		succMsgTip('未婚时，婚姻状态为空');
	}
}

/*
 * 入厂时间验证
 */
function joinTime(ele){
	var tbe_work_area = $('#tbe_work_area').val();
	var tbe_join_time = $('#tbe_join_time').val();
	if('' != tbe_work_area && '' != tbe_join_time){
		var res = compareDate(tbe_work_area, tbe_join_time);
		if(null == res || res > 0){
			ele.value = '';
			succMsgTip('工作时间应小于等于入厂时间');
			return;
		}
		var a = tbe_work_area.substr(0,4);
		var b = tbe_join_time.substr(0,4);
		$('#tbe_seniority').val(parseInt(b) - parseInt(a));
	}
}

</script>
	<body>
		<table class="serTable">
			<tr>
				<td>
					机构：<select id="org2" style=" width: 160px;">
						<%=user.getCurSubOrgOptions()%>
					</select>
				</td>
				<td>
					用工形式：<select id="ser5" style=" width: 160px;">
						<option value="0">全部</option>
						<%=tbe_employment_forms%>
					</select>
				</td>
				<td>职工号：<input id="ser3"/></td>
				<td><input class="btn2" value="搜索" type="button" onclick="serch1();" /></td>
				<td></td>
			</tr>
			<tr>
				<td>姓名：<input id="ser1"/></td>
				<td>拼音码：<input id="ser2"/></td>
				<td>身份证：<input id="ser4"/></td>
				<td><input class="btn2" value="高级搜索" type="button" onclick="serch2();" /></td>
				<td><input class="btn2" value="重置" type="button" onclick="serReset();" /></td>
			</tr>
		</table>
		
		<div id="emp-grid"></div>
		
		<!-- <div id="empAdd-div" style="display: none;">
			<form id="emp-form" name="emp-form">
				<input type="hidden" id="tbe_id" name="tbe_id" value="" />
				<input type="hidden" id="tbe_political_status" name="tbe_political_status" value="" />
				<input type="hidden" id="reserve1" name="reserve1" value="" />
				<input type="hidden" id="reserve2" name="reserve2" value="" />
				<input type="hidden" id="reserve3" name="reserve3" value="" />
				<input type="hidden" id="reserve4" name="reserve4" value="" />
				<input type="hidden" id="reserve5" name="reserve5" value="" />
				<input type="hidden" id="create_by" name="create_by" value="" />
				<input type="hidden" id="create_time" name="create_time" value="" />
				<input type="hidden" id="last_modify_by" name="last_modify_by" value="" />
				<input type="hidden" id="last_modify_time" name="last_modify_time" value="" />
				
				<table class="form_table">
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold;height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif">
								<span>基础信息</span>
							</div>
						</td>
					</tr>
					<tr>
						<td class="form_label">机构：</td>
						<td>
							<select id="org_id" name="org_id" style=" width: 182px;">
								<%=user.getCurSubOrgOptions()%>
							</select>
						</td>
						<td><font color="red">*</font></td>
						<td class="form_label">姓名：</td>
						<td><input class="textbg1" id="tbe_name" name="tbe_name" validate="{required:true,maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td><font color="red">*</font></td>
						<td class="form_label">曾用名：</td>
						<td><input class="textbg1" id="tbe_former_name" name="tbe_former_name" validate="{maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">拼音码：</td>
						<td><input class="textbg1" id="tbe_spell_code" name="tbe_spell_code" validate="{maxlength:32}" onblur="toUpper(this);" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">性别：</td>
						<td align="left" id="tbe_sex">
							<input style="margin-top: 2px;" type="radio" name="tbe_sex" value="男" checked="checked" />男
							<input style="margin-top: 2px;" type="radio" name="tbe_sex" value="女" />女
						</td>
						<td></td>
						<td class="form_label">排序号：</td>
						<td><input class="textbg1" id="tbe_order" name="tbe_order" validate="{digits: true, maxlength:18}" value="0" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">身份证号：</td>
						<td><input class="textbg1" id="tbe_idcard" name="tbe_idcard" validate="{required:true,maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td><font color="red">*</font></td>
						<td class="form_label">出生日期：</td>
						<td><input id="tbe_birthday" name="tbe_birthday" readonly="readonly"></td>
						<td></td>
						<td class="form_label">年龄：</td>
						<td><input class="textbg1" id="tbe_age" name="tbe_age" validate="{digits:true,max:100}" value="0" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">民族：</td>
						<td>
							<select id="tbe_nation" name="tbe_nation" style=" width: 182px;">
								<%=tbe_nation%>
							</select>
						</td>
						<td></td>
						<td class="form_label">籍贯：</td>
						<td><input class="textbg1" id="tbe_native_palce" name="tbe_native_palce" validate="{maxlength:64}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">出生地：</td>
						<td><input class="textbg1" id="tbe_birthplace" name="tbe_birthplace" validate="{maxlength:64}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">家庭住址：</td>
						<td><input class="textbg1" id="tbe_address" name="tbe_address" validate="{maxlength:128}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">家庭电话：</td>
						<td><input class="textbg1" id="tbe_family_phone" name="tbe_family_phone" validate="{maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">手机：</td>
						<td><input class="textbg1" id="tbe_mobile" name="tbe_mobile" validate="{maxlength:16}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">毕业学校：</td>
						<td><input class="textbg1" id="tbe_graduate_college" validate="{maxlength:64}" name="tbe_graduate_college" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">学历：</td>
						<td>
							<select id="tbe_qualification" name="tbe_qualification" style=" width: 182px;">
								<%=tbe_qualification %>
							</select>
						</td>
						<td></td>
						<td class="form_label">所学专业：</td>
						<td><input class="textbg1" id="tbe_major" name="tbe_major" validate="{maxlength:64}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold; height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif">
								<span>工作信息</span>
							</div>
						</td>
					</tr>
					<tr>
						<td class="form_label">职工证号：</td>
						<td><input class="textbg1" id="tbe_work_permit" name="tbe_work_permit" validate="{maxlength:64}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">职务：</td>
						<td><input class="textbg1" id="tbe_position" name="tbe_position" validate="{maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">员工状态：</td>
						<td>
							<select id="tbe_status" name="tbe_status" style=" width: 182px;">
								<%=tbe_status%>
							</select>
						</td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">用工形式：</td>
						<td>
							<select id="tbe_employment_forms" name="tbe_employment_forms" style=" width: 182px;">
								<%=tbe_employment_forms%>
							</select>
						<td></td>
						<td class="form_label">工作时间：</td>
						<td><input id="tbe_work_area" name="tbe_work_area" onblur="joinTime(this);" readonly="readonly"></td>
						<td></td>
						<td class="form_label">入厂时间：</td>
						<td><input id="tbe_join_time" name="tbe_join_time" onblur="joinTime(this);" readonly="readonly"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">工龄：</td>
						<td><input class="textbg1" id="tbe_seniority" name="tbe_seniority" validate="{digits:true,maxlength:18}" value="0" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold; height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif">
								<span>婚姻信息</span>
							</div>
						</td>
					</tr>
					<tr>
						<td class="form_label">婚姻状态：</td>
						<td>
							<select id="tbe_marital_status" name="tbe_marital_status" style=" width: 182px; margin-left: 1px;">
								<%=tbe_marital_status %>
							</select>
						</td>
						<td></td>
						<td class="form_label">婚姻状况：</td>
						<td>
							<select id="tbe_marital_condition" name="tbe_marital_condition" onchange="changeEvent1(this);" style=" width: 182px; margin-left: 1px;">
								<option value=""></option>
								<%=tbe_marital_condition %>
							</select>
						</td>
						<td></td>
						<td class="form_label">结婚时间：</td>
						<td><input id="tbe_married_time" name="tbe_married_time" readonly="readonly"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">结婚证号：</td>
						<td><input class="textbg1" id="tbe_marriage_certificate" name="tbe_marriage_certificate" validate="{maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
						<td class="form_label">是否晚婚：</td>
						<td align="left" id="tbe_is_late_marriage">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_late_marriage" value="1" checked="checked" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_late_marriage" value="0" />否
						</td>
						<td></td>
						<td class="form_label">是否晚育：</td>
						<td align="left" id="tbe_is_late_birth">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_late_birth" value="1" checked="checked" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_late_birth" value="0" />否
						</td>
						<td></td>
					</tr>
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold; height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif">
								<span>生育信息</span>
							</div>
						</td>
					</tr>
					<tr>
						<td class="form_label">生育能力状态：</td>
						<td align="left">
							<select id="tbe_ba_status" name="tbe_ba_status" style="width:182px;">
								<%=tbe_ba_status %>
							</select>
						</td>
						<td></td>
						<td class="form_label">节育措施：</td>
						<td>
							<select id="tbe_birth_control_measures" name="tbe_birth_control_measures" style="width:182px;">
								<%=tbe_birth_control_measures%>
							</select>
						<td></td>
						<td class="form_label">子女情况：</td>
						<td><input class="textbg1" id="tbe_children_status" name="tbe_children_status" validate="{maxlength:128}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">重点服务对象：</td>
						<td align="left" id="tbe_is_es">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_es" value="1" checked="checked" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_es" value="0" />否
						</td>
						<td></td>
						<td class="form_label">重点时间：</td>
						<td><input id="tbe_es_time" name="tbe_es_time" readonly="readonly"></td>
						<td></td>
						<td class="form_label">重点理由：</td>
						<td><input class="textbg1" id="tbe_es_reason" name="tbe_es_reason" validate="{maxlength:32}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">是否允许再生育：</td>
						<td align="left" id="tbe_is_again_birth">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_again_birth" value="1" checked="checked" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_again_birth" value="0" />否
						</td>
						<td></td>
						<td class="form_label">是否不孕症：</td>
						<td align="left" id="tbe_is_barrenness">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_barrenness" value="1" checked="checked" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_barrenness" value="0" />否
						</td>
						<td></td>
						<td class="form_label">是否绝经：</td>
						<td align="left" id="the_is_menopause">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="the_is_menopause" value="1" checked="checked" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="the_is_menopause" value="0" />否
						</td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">备注：</td>
						<td><input class="textbg1" id="tbe_memo" name="tbe_memo" validate="{maxlength:512}" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"></td>
						<td></td>
					</tr>
					<tr><td><br /></td></tr>
				</table>
			</form>
		</div>-->
		<div id="org-tree-win" style="display: none;">
			<div id="org-tree"></div>
		</div>
		<div id="org1-tree-win" style="display: none;">
			<div id="org1-tree"></div>
		</div>
		
		<!-- 将用到的两个常用逻辑运算符初始化在页面中便于上面的使用  -->
		<div style="display: none;" id="condition">
			<select name="luojiOne">
				<option value="=">等于</option>
				<option value="<>">不等于</option>
				<option value=">">大于</option>
				<option value="<"">小于</option>
				<option value="is null">为NULL</option>
				<option value="like">包含</option>
				<option value="in">在...之中(1,2,3)</option>
				<option value="between">在...之间(1,2)</option>
			</select>
		</div>
		<div style="display: none;" id="conditionAnd">
			<select name="luojiTwo">
				<option value="and">与</option>
				<option value="or">或</option>
			</select>
		</div>
		<div id="tallSearch" style="display: none;">
			<table width="99%" height="100%">
				<tr>
					<td width="20%">字段列表</td>
					<td width="80%" style="text-algin: center;">
						<table width="100%">
							<tr>
								<td width="60px">字段名称</td>
								<td width="130px">条件匹配</td>
								<td width="150px">字段赋值</td>
								<td width="90px">条件关系</td>
								<td width="60px">移除操作</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<!-- select中给定的字段为数据库中字段，此处给出表明，是为了后台有多表查询时使用，但是此查询并不适合嵌套查询（子查询） 后台有统一替换过程  -->
					<td width="20%" style="vertical-align: top;">
						<select id="sel" style="height: 356px; width: 120px;" ondblclick="tallSearchCols(this.value);" multiple="multiple">
							<option value="tbe_name">姓名</option>
							<option value="tbe_former_name">曾用名</option>
							<option value="tbe_spell_code">拼音码</option>
							<option value="tbe_sex">性别</option>
							<option value="tbe_order">排序号</option>
							<option value="tbe_idcard">身份证号</option>
							<option value="tbe_birthday">出生日期</option>
							<option value="tbe_age">年龄</option>
							<option value="tbe_nation">民族</option>
							<option value="tbe_native_palce">籍贯</option>
							<option value="tbe_birthplace">出生地</option>
							<option value="tbe_address">家庭住址</option>
							<option value="tbe_family_phone">家庭电话</option>
							<option value="tbe_mobile">手机</option>
							<option value="tbe_graduate_college">毕业学校</option>
							<option value="tbe_qualification">学历</option>
							<option value="tbe_major">所学专业</option>
							<option value="tbe_work_permit">职工证号</option>
							<option value="tbe_position">职务</option>
							<option value="tbe_status">员工状态</option>
							<option value="tbe_employment_forms">用工形式</option>
							<option value="tbe_work_area">工作时间</option>
							<option value="tbe_join_time">入厂时间</option>
							<option value="tbe_seniority">工龄</option>
							<option value="tbe_marital_status">婚姻状态</option>
							<option value="tbe_marital_condition">婚姻状况</option>
							<option value="tbe_married_time">结婚时间</option>
							<option value="tbe_marriage_certificate">结婚证号</option>
							<option value="tbe_is_late_marriage">是否晚婚</option>
							<option value="tbe_is_late_birth">是否晚育</option>
							<option value="tbe_is_again_birth">是否允许再生育</option>
							<option value="tbe_is_barrenness">是否不孕症</option>
							<option value="the_is_menopause">是否绝经</option>
							<option value="tbe_ba_status">生育能力状态</option>
							<option value="tbe_is_es">是否重点服务对象</option>
							<option value="tbe_es_time">设为重点时间</option>
							<option value="tbe_es_reason">重点理由</option>
							<option value="tbe_birth_control_measures">节育措施</option>
							<option value="tbe_children_status">子女情况</option>
							<option value="tbe_memo">备注</option>
						</select>
					</td>
					<td width="80%" style="text-algin: center;" valign="top">
						<table width="100%" id="appendTable">
						</table>
					</td>
				</tr>
			</table>
		</div>
		
		
	</body>
</html>










